
%include 'C:\Users\maggi\Documents\Manuscript\Work from home\Programs\WFH.sas'; *call in the datastep codes;

**********************************************************************************************
                                        COMPARISON 
********************************************************************************************** ;

data compare; 
set wellbeing_p;

if nmiss (of work_home2018 distracted2019_r w_productive2019 wkfamilyconfl2019 jobsatis2019 
             age_cat2018c gender2018 race22018c mart_status2018c educ2018c home2018c depressed2018 physhlth2018 
             n_children2018 n_elders2018 no_animal2018c work_hours2018c w_meaning2018 w_recognized2018 w_team2018 purpose2018 
             distracted2018_r w_productive2018 wkfamilyconfl2018 jobsatis2018)>0 then include=0;
else include=1;

proc freq;
tables include;
run;

proc freq;
tables include*(work_home2018 race22018c age_cat2018c gender2018 mart_status2018c educ2018c home2018c n_children2018c elders2018c no_animal2018c work_hours2018c)/chisq;
format race22018c race22018c. age_cat2018c age_cat2018c. gender2018 gender2018c. mart_status2018c mart_status2018c. educ2018c educ2018c. 
home2018c home2018c. n_children2018c n_children2018c. elders2018c elders2018c. no_animal2018c no_animal2018c. work_hours2018c work_hours2018c.;
run;

%macro univ(outcome);
proc glm data=compare; 
class include;
model &outcome.=include;
means include;
run;
%mend;

%univ(outcome=depressed2018);
%univ(outcome=physhlth2018 );
%univ(outcome=purpose2018);
%univ(outcome=w_meaning2018);
%univ(outcome=w_recognized2018);
%univ(outcome=w_team2018);
%univ(outcome=distracted2018_r);
%univ(outcome=wkfamilyconfl2018);
%univ(outcome=w_productive2018);
%univ(outcome=jobsatis2018);
%univ(outcome=n_children2018);
%univ(outcome=n_elders2018);
run;
